package com.twu.biblioteca.Command;

import com.twu.biblioteca.BibiliotecaModel;
import com.twu.biblioteca.Book;

import java.io.PrintWriter;

public class ShowBooksCommand implements IBibiliotecaCommand {
    private PrintWriter out;

    public void ICommand(PrintWriter outputBuffer) {
        out = outputBuffer;
        showAllBooks();
    }

    private void showAllBooks() {
        out.println("view all books");
        for (int i = 0; i < BibiliotecaModel.getBooks().size(); i++) {
            Book book = BibiliotecaModel.getBooks().get(i);
            out.println(book.getTitle());
        }
    }

}
